<html><!-- InstanceBegin template="/Templates/_Admin_Template.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- InstanceBeginEditable name="doctitle" -->
<title>TCedit 测试用例编写工具 - 用户管理</title>
<!-- InstanceEndEditable -->
<link rel="shortcut icon" href="favicon.ico">
<link href="/css/common.css" rel="stylesheet" type="text/css">
<script src="/js/prototype.js"></script>
<script src="/js/common.js"></script>
<script>
function doAction(action){
  if (action == "create") {
    document.formData.action = "/admin/user.jspx?action=create&page=${page}";
  } else if (action == "update") {
    document.formData.action = "/admin/user.jspx?action=update&id=${user.id}&page=${page}";
  } else if (action == "delete") {
    if(confirm("是否确定要删除？")) {
      document.formData.action = "/admin/user.jspx?action=delete&id=${user.id}&page=${page}";
      document.formData.submit();
    }
  }
}
</script>
<script src="/js/md5.js"></script>
<script>
function checkForm(){
	if($F("username")==""){
		alert("请输入用户名！");
		return false;
	}
#if($action=="" || $action=="create")
	if($F("password1")!=$F("password2")){
		alert("两次口令不一致！");
		return false;
	}
	if($F("password1").length<6) {
		alert("口令至少为6个字符！");
		return false;
	}
#end
	if($F("realName")==""){
		alert("请输入真实姓名！");
		return false;
	}
	if($F("email")==""){
		alert("请输入正确的电子邮件地址！");
		return false;
	}
#if($action=="" || $action=="create")
	$("username").value=$F("username").toLowerCase();
	$("password").value=hex_md5("rslai.OrG_" + $F("password1") + "_rslai.OrG");
	$("password1").value=fakepwd("password1");
	$("password2").value=fakepwd("password2");
#end

	return true;
}
</script>
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
</head>

<body>
<!-- InstanceBeginEditable name="MainContent" -->
<table width="99%" align="center" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="100%" valign="top">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td colspan="4" bgcolor="#dedeef"><b>用户信息</b></td>
        </tr>
        <tr>
          <td></td>
          <td>
            #if($error)
              <font color="#FF0000">$error</font>
            #end
          </td>
        </tr>
        <form action="" method="post" enctype="multipart/form-data" name="formData" id="formData" onSubmit="return checkForm()">
        <tr>
          <td width="15%" align="right">用户名：</td>
          <td width="85%"><input name="username" type="text" class="text" id="username" style="width:200px;" value="$!{user.username}" maxlength="40" /> <b><font color="#FF0000">*</font></b> 6至40个英文字母或数字</td>
        </tr>
#if($action=="" || $action=="create")
        <tr>
          <td align="right">口令：</td>
          <td><input name="password1" type="password" class="text" id="password1" maxlength="20" style="width:200px;" /> <b><font color="#FF0000">*</font></b> 6至20个英文字母，数字或特殊符号</td>
        </tr>
        <tr>
          <td align="right">重复口令：</td>
          <td>
            <input name="password2" type="password" class="text" id="password2" maxlength="20" style="width:200px;" />
            <b><font color="#FF0000">*</font></b>
            <input name="password" type="hidden" id="password" />
          </td>
        </tr>
#end
        <tr>
          <td align="right">真实姓名：</td>
          <td><input name="realName" type="text" class="text" id="realName" style="width:200px;" value="$!{user.realName}" maxlength="20" /> <b><font color="#FF0000">*</font></b></td>
        </tr>
        <tr>
          <td align="right">电子邮件：</td>
          <td><input name="email" type="text" class="text" id="email" style="width:200px;" value="$!{user.email}" maxlength="50" /> <b><font color="#FF0000">*</font></b></td>
        </tr>
        <tr>
          <td align="right"></td>
          <td><input name="locked" type="checkbox" id="locked" value="true" #if($user.locked) checked #end>锁定此用户</input></td>
        </tr>
        <tr>
          <td><BR></td>
          <td></td>
        </tr>
        <tr>
          <td align="right">系统角色：</td>
          <td>（将鼠标停留在角色描述上可以显示该角色的角色名）</td>
        </tr>
        <tr>
          <td></td>
          <td>
            <table border="0">
              #foreach($role in $roles)
              <tr>
                <td>
                  <input input name="roleID" id="roleID" type="checkbox" value="$!{role.id}"
                    #foreach($userRole in $user.roles)
                      #if($role.id==$userRole.id)
                        checked
                      #end
                    #end
                  />
                  <a Title="$!{role.name}">$!{role.describing}</a></br>
                </td>
              </tr>
            #end
            </table>
          </td>
        </tr>
        <tr>
          <td></td>
          <td>
            #if($action=="" || $action=="create")
              <input name="SubmitCreate" type="submit" class="button" id="SubmitCreate" value="新增" onClick="doAction('create')" />
            #else
              #if (!($action=="delete"))
                <input name="SubmitUpdate" type="submit" class="button" id="SubmitUpdate" value="修改" onClick="doAction('update')" />
              #end
              <input name="SubmitDelete" type="button" class="button" id="SubmitDelete" value="删除" onClick="doAction('delete')" />
            #end
          </td>
          <td></td>
          <td></td>
        </tr>
        </form>
      </table>
    </td>
  </tr>
</table>
<!-- InstanceEndEditable -->
</body>
<!-- InstanceEnd --></html>